#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int arr1[20] = { 97,92,0,0,89,82,0,0,0,95,0,0,94,0,0,0,98,93,0,0 };
    int arr2[20] = { 90,85,0,0,83,86,0,97,0,99,0,0,91,83,0,0,83,87,0,99 };
    int arr3[20] = { 0,96,0,0,97,0,0,96,89,0,96,0,0,87,98,0,99,92,0,96 };
    int arr4[20] = { 0,0,0,80,0,0,87,0,0,0,97,93,0,0,97,93,98,96,89,95 };
    int arr5[20] = { 0,0,93,86,0,0,90,0,0,0,0,98,0,0,98,86,81,98,92,81 };
    int a, b, c, d, e, n, max = 0;
    for (a = 0; a < 20; a++) 
    {
        for (b = 0; b < 20; b++) 
        {
            for (c = 0; c < 20; c++) 
            {
                for (d = 0; d < 20; d++) 
                {
                    for (e = 0; e < 20; e++) 
                    {
                        n = arr1[a] + arr2[b] + arr3[c] + arr4[d] + arr5[e];

                        //不同数组的数组下标取同一个数是，代表是同一个队员，要排除这种情况
                        if (max <= n && a != b && a != c && a != d && a != e && b != c && b != d && b != e && c != d && c != e && d != e) 
                        { 
                            max = n; 
                        }
                    }
                }
            }
        }
    }
    printf("%d\n", max);

    system("pause");
    return 0;
}